
namespace TFSChangeLog.View.Services
{
    using System;
    using System.Windows;
    using TFSChangeLog.ViewModel;

    /// <summary>
    /// Provides services for the View.
    /// </summary>
    public static class ViewServices
    {
        #region Fields

        /// <summary>Summary description for class level field of type <c>TFSChangeLog.View.ProgressDialog</c>.</summary>
        private static ProgressDialog m_ProgressDialog;

        #endregion

        #region Service Methods

        /// <summary>
        /// Close the Progress dialog.
        /// </summary>
        internal static void CloseProgressDialog()
        {
            try
            {
                m_ProgressDialog.Close();
            }
            catch (Exception ex)
            {
                // IGNORE exception while closing Progress Dialog Box.
            }
        }

        /// <summary>
        /// Shows the Progress dialog.
        /// </summary>
        /// <param name="mainWindow">TODO: Summary description for <c>mainWindow</c> parameter of type <c>System.Windows.Window</c>.</param>
        /// <param name="viewModel">TODO: Summary description for <c>viewModel</c> parameter of type <c>TFSChangeLog.ViewModel.ProgressDialogViewModel</c>.</param>
        internal static void ShowProgressDialog(Window mainWindow, ProgressDialogViewModel viewModel)
        {
            m_ProgressDialog = new ProgressDialog();
            m_ProgressDialog.Owner = mainWindow;
            m_ProgressDialog.DataContext = viewModel;
            m_ProgressDialog.Show();
        }

        #endregion
    }
}